#ifndef DEEPSORT_H
#define DEEPSORT_H


#include <vector>
#include <memory>
#include <opencv2/opencv.hpp>

#include "Track.h"
#include "PedestrianBox.h"



template<typename T>
class TrackerManager;

template<typename T>
class FeatureMetric;

//static int roi_h = 128, roi_w = 64;

class TrackingAlgorithm {

public:
    explicit TrackingAlgorithm(int width, int height, void *detector, void *extractor);

    TrackingAlgorithm() = delete;

    TrackingAlgorithm(TrackingAlgorithm &) = delete;

    ~TrackingAlgorithm();

    /*
     * return tracking results
     * */
    std::vector <std::vector<float>> update(const cv::Mat &ori_img);

    /*
     * return tracking and detection results
     * */
    std::vector<Detection> update(const cv::Mat &ori_img, std::vector <std::vector<Detection>> &pedestrianbox);

private:
    std::vector <std::vector<cv::Rect2f>> getDetections(std::vector <std::vector<Detection>> &pedestrianbox);

    int height, width;

    class TrackData;

    std::vector<Detection> tracking_assistant;
//    std::vector<std::vector<cv::Rect2f>> detections;
    std::vector <TrackData> data;
    // input inference engine
    // include detect and reid engine
    void *re_id, *obj_det;
    std::unique_ptr <TrackerManager<TrackData>> manager;
    std::unique_ptr <FeatureMetric<TrackData>> feat_metric;
    // osnet: 2048
    // fastrt: 512
    int reid_feature = 2048;
};


#endif //DEEPSORT_H
